#ifndef CELL_H
#define CELL_H

#include <QTableWidgetItem>

class CCell : public QTableWidgetItem
{
public:
    CCell();

    QTableWidgetItem *clone() const;
    void setData(int role, const QVariant &value);
    QVariant data(int role) const;
    void setFormula(const QString &sFormula_);
    QString formula() const;
    void setDirty();

private:
    QVariant value() const;
    // returns the cell's value.
    QVariant evalExpression(const QString &str, int &pos) const;
    QVariant evalTerm(const QString &str, int &pos) const;
    QVariant evalFactor(const QString &str, int &pos) const;

    mutable QVariant _vCachedValue;
    mutable bool _bCacheIsDirty;
};


#endif // CELL_H
